  {% include file="index.header.tpl.php" %}
  {% include file="index.left.tpl.php" %}
   <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <section class="col-lg-12 connectedSortable">
         <div class="box box-default box-solid">
             <form name="myform" action="" method="get">
                <div class="box-header with-border">
                    <span class="fa fa-table" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                    <p class="box-title">学期汇总表</p>
                
                </div>
                   <div class="box-body">
                    <div class="col-sm-3 form-group">
						  <label for="inputPassword3" class="col-sm-4 control-label text-right" style="padding:0;">
							   学年学期：
						  </label>
						  <div class="input-group col-sm-8 col-xs-12">
							   <select class="form-control" id="semester_id" name="semester_id">
                                      <option value="">请选择</option>
									{%foreach from=$semester_lists key=key item=value%}
									  <option value="{%$key%}" {%if $key==$semester_id%}selected{%/if%}>
									  {%$value%}</option>
									{%/foreach%}
                                </select>
						  </div> 
				     </div>
                     <div class="col-sm-3 form-group">
						  
						  <input type="hidden" name="a" value="sanitation.semesterlist">
                          <button type="submit" class="btn btn-primary">确 定</button>
				     </div>  
                     <div style="clear:both; height:10px;"></div>
                       <h4 class="text-center">{%$semester_data.semester_name%}各班汇总表</h4>
                      <table class="table table-bordered"  id="mytable">
                                    <tr>
									    <td rowspan="2">班级</td>
										{%foreach from=$semester_month key=key item=value%}
										<td colspan="2" align="center">第{%$value.semester_month%}学月</td>
                                        {%/foreach%}
										<td colspan="2" align="center">合计</td>
                                    </tr>
									
                                    <tr>
										{%foreach from=$semester_month key=key item=value%}
										<td>常规</td>
										<td>其他</td>
										 {%/foreach%}
										<td>常规</td>
										<td>其他</td>
									</td>										
                                    </tr>
                          {%foreach from=$class_lists key=key item=value%}
                          <tr>
                              <td>{%$value.class_name%}</td>
                              {%foreach from=$value.infos key=ke item=va%}
                              <td>{%$va.sanitation_rule%}</td>
                              <td>{%$va.sanitation_rests%}</td>
                              {%/foreach%}
                              <!--<td>{%$value.content.sanitation_rule%}</td>
                             <td>{%$value.content.sanitation_rests%}</td>-->
                          </tr>
                          {%/foreach%}
                      </table>
				   </div><!--box-body -->
                   <div class="box-footer text-center">
				   {%$page%}
                   </div>
               </form>
           </div><!--box box-default box-solid-->
        </section>   
        </div><!--row-->
    </section>
 </div>
  <!--主要内容结束-->
  {% include file="index.footer.tpl.php" %}
 <!--      二级联动     -->
<script type="text/javascript">
        $(document).ready(function () {
            $("#semester_id").change(function () {		
                if ($(this).val() == "-1") {
					$("#industr").remove(); return; 
					}
                else {
			var timestamp = new Date().getTime();
			$.ajax({
			url:"index.php?a=sanitation.monthlistjson",
			type:"get",
			data: "semester_id=" + $("#semester_id").find("option:selected").val() + "&timestamp=" + timestamp,
			dataType:"json",
			success:function(msg){
			   
					//实例2个字符串变量来拼接下拉列表
					var industr = "";
					//使用jquery解析json中的数据
					$.each(msg, function (n, value) {
						industr += ("<option value=\"" + value.semester_month + "\">" + value.semester_month);
						industr += ("</option>");
					});

					$("#semester_month").html(industr);			   			   
			}
			});					

                }

            });

        });
</script>